
@Override
public boolean add(Setmeal setmeal) {
    boolean flag = false;
    try {
        // 保存体检套餐基本信息
        setmealMapper.add(setmeal);
        
        // 获取体检套餐ID
        Integer setId = setmeal.getId();
        
        // 保存体检套餐和检查组的关联关系
        if (setmeal.getCheckGroupIds() != null) {
            for (Integer checkGroupId : setmeal.getCheckGroupIds()) {
                Map<String, Integer> relation = new HashMap<>();
                relation.put("setmeal_id", setId);
                relation.put("checkgroup_id", checkGroupId);
                setmealMapper.saveSetmealAndCheckgroup(relation);
            }
        }
        
        flag = true;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return flag;
}
